# -*- coding: utf-8 -*-
"""
Created on Thu Sep 12 16:42:58 2019

@author: Administrator
"""

# 1012 数字分类
# 解题思路：按照要求求出数字的分类，再计算分类数值
# 注意：
# 1.输出时，“若其中某一类数字不存在，则输出N”，若分类存在数字，但所求值为0，也没关系
# 题目中A1类为N，可以观察出A1的分类应是被5整数的偶数
# A2类，按照上述分析，如果所求值为0也没关系。

"""
def test():
    result = []
    raw_list = str(input()).split(' ')
    number = int(raw_list.pop(0))
    if number > 1000:
        return

    data_list = []
    for ele in raw_list:
        ele = int(ele)
        if ele > 1000:
            return
        data_list.append(ele)
    
    a1_list, a2_list, a3_list, a4_list, a5_list = list_classify(data_list)
    
    a1 = even_sum(a1_list)
    a2 = intersect_sum(a2_list)
    a3 = len(a3_list)
    a4 = average(a4_list)
    a5 = max_list(a5_list)
    
    # 如果某类数字不存在，输出N
    if a1 == 0:
        result.append('N')
    else:
        result.append(str(a1))
    if len(a2_list) == 0:
        result.append('N')
    else:
        result.append(str(a2))
    if a3 == 0:
        result.append('N')
    else:
        result.append(str(a3))
    if a4 == 0:
        result.append('N')
    else:
        result.append(str(a4))
    if a5 == 0:
        result.append('N')
    else:
        result.append(str(a5))
        
    print(' '.join(result))

def even_sum(data_list):
    
    result = 0
    
    for ele in data_list:
        if ele % 2 == 0:
            result = result + ele
    return result

#print(even_sum([1,2,3,4,5]))

def intersect_sum(data_list):
    result = 0
    
    for i in range(len(data_list)):
        result = result + (-1)**i * data_list[i]
    return result

#print(intersect_sum([1,2,3,4,5]))
def average(data_list):
    result = 0
    temp = 0
    if len(data_list) == 0:
        return result
    
    for ele in data_list:
        temp = temp + ele
        
    result = temp / len(data_list)
    return float("%.1f" % result)

#print(average([1,2,7]))
def max_list(data_list):
    result = 0

    for ele in data_list:
        if ele > result:
            result = ele
    return result

#print(max_list([1,2]))

def list_classify(data):
    a1_list = []
    a2_list = []
    a3_list = []
    a4_list = []
    a5_list = []
    for ele in data:
        if ele % 5 == 0:
            a1_list.append(ele)
        elif ele % 5 == 1:
            a2_list.append(ele)
        elif ele % 5 == 2:
            a3_list.append(ele)
        elif ele % 5 == 3:
            a4_list.append(ele)
        elif ele % 5 == 4:
            a5_list.append(ele)
    return a1_list, a2_list, a3_list, a4_list, a5_list

test()
"""